import json
import os

# filePath = 'D:\\Projectspace\\python\\github\\AutoRclone-master\\accounts1\\'
filePath = 'C:\\Users\\40138\\Desktop\\tmp\\'


def readname():
    name = os.listdir(filePath)
    return name


if __name__ == "__main__":
    fout = open("C:\\Users\\40138\\Desktop\\tmp\\sa_emails20000.txt", 'w', encoding='utf-8')
    name = readname()
    a = 0
    for i in name:
        if i == '.keep':
            continue
        a += 1
        try:
            path = filePath + i
            data3 = json.load(open(path, encoding="utf8"))
            fout.write(data3["client_email"] + "\n")
        except:
            print("读取失败-->", path)
    print(a)
